package com.file.service;

import com.file.common.BusinessConstants;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * @Auther: ZGS
 * @Date: 2019/1/25 11:38
 * @Description:
 */
@Service
public class FileService {


    public Object downloadTemplate(String type) {

        if (StringUtils.isBlank(type)) {
            throw  new RuntimeException("type为空");
        }

        //获取文件名
        String templateByType = getTemplateByType(type);



        return null;
    }


    /*
根据模板类型ID获取模板文件名
 */
    public String getTemplateByType(String fileType) {

        String templateName = null;
        switch (Integer.valueOf(fileType)) {
            case BusinessConstants.UPLOAD_TYPE_TRANSCEIVER:
                templateName = "客户导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_ITEM:
                templateName = "商品导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_ZONE:
                templateName = "储位导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_TURNOVERBOX:
                templateName = "容器导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_PICK_INBOUND:
                templateName = "采购入库订单导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_RETURN_INBOUND:
                templateName = "退货入库订单导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_DELIVERY_OUTBOUND:
                templateName = "销售出库订单导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_RETURN_OUTBOUND:
                templateName = "退货出库订单导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_TRANSFER:
                templateName = "transferTemplate.xls";// !!!!!!!
                break;
            case BusinessConstants.UPLOAD_TYPE_INVENTORY:
                templateName = "库存导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_SN:
                templateName = "snTemplate.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_BATCHINVENTORYATTRIBUTETRANSFERBYIEMI:
                templateName = "batchInventoryAttributeTransferByIEMI.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_BATCHINVENTORYATTRIBUTETRANSFERBYPRODUCT:
                templateName = "batchInventoryAttributeTransferByProduct.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_BATCHSTOCKRIGHTTRANSFERBYIMEI:
                templateName = "batchStockRightTransferByIMEI.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_BATCHSTOCKRIGHTTRANSFERBYPRODUCT:
                templateName = "batchStockRightTransferByProduct.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_ITEMLOCATION:
                templateName = "商品指定储位导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_VENDERLOGISTICSNO:
                templateName = "logistics.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_MAGAZINES:
                templateName = "magazineTemplate.xlsx";
                break;
            case BusinessConstants.UPLOAD_TYPE_LINENO:
                templateName = "储位动线导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_ITEM_ABCCLASS:
                templateName = "itemAbcClassTemplate.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_CARRIER_PRIOD:
                templateName = "carrierPriodTemplate.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_COMBINEITEM:
                templateName = "combineItemTemplate.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_SAFETYSTOCK:
                templateName = "safetyStockTemplate.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_INVENTORYADJUST:
                templateName = "损溢单导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_INVENTORY_FROZEN:
                templateName = "batchInventoryFrozen.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_INVENTORY_UNFROZEN:
                templateName = "batchInventoryUnfrozen.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_INVENTORY_LOCATION_MOVE:
                templateName = "移库单导入.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_CUSTOMER_LOCATION_ZONE:
                templateName = "customerLocationTemplate.xls";
                break;
            case BusinessConstants.UPLOAD_TYPE_ITEM_PACKAGING:
                //包装规则导入
                templateName = "itemPackagingCode.xlsx";
                break;
            case BusinessConstants.UPLOAD_TYPE_TRANSFER_ORDER:
                templateName = "调拨订单导入.xlsx";
                break;
            case BusinessConstants.UPLOAD_SINGLE_TYPE_ITEM:
                templateName = "singleItemTemplate.xls";
                break;
            case BusinessConstants.INVENTORY_DATE:
                templateName = "inventoryDate.xls";
                break;
            case BusinessConstants.EXPIRED_DATE:
                templateName = "expiredDate.xls";
                break;
            default:
                break;
        }
        return templateName;
    }
}
